<%@ Page Language="VB" MasterPageFile="~/Default.master" AutoEventWireup="false" CodeFile="ManageUsers.aspx.vb" Inherits="Admin_MannageUsers" title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div id="body">
    <div class="fullwidth">
    <asp:LinkButton ID="AllUsersBtn" runat="server" Text="All Users" /><br />
    <asp:LinkButton ID="ApprovedUsersBtn" runat="server" Text="Approved Users" /><br />
    <asp:LinkButton ID="UnapprovedUsersBtn" runat="server" Text="Unapproved Users" />
    </div>
<div class="fullwidth">
<asp:ScriptManager ID="sm" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="Up1" runat="server">
<Triggers>
    <asp:AsyncPostBackTrigger ControlID="AllUsersBtn" EventName="Click" />
    <asp:AsyncPostBackTrigger ControlID="ApprovedUsersBtn" EventName="Click" />
    <asp:AsyncPostBackTrigger ControlID="UnapprovedUsersBtn" EventName="Click" />
</Triggers>
<ContentTemplate>
<asp:GridView ID="AllUsersGrid" runat="server" AutoGenerateColumns="False" DataKeyNames="UserName" GridLines="None" Width="678px" DataSourceID="SqlDataSource1">
      <Columns>
         <asp:TemplateField HeaderText="Name">
            <ItemTemplate>
                <asp:Label id="DisplayName" runat="server" Text='<%# Eval("firstname").ToString() & " " & Eval("lastname").ToString() %>' />
            </ItemTemplate>
         </asp:TemplateField>
         <asp:BoundField HeaderText="UserName" DataField="UserName" />
         <asp:TemplateField HeaderText="E-Mail">
            <ItemTemplate>
                <asp:HyperLink ID="email" runat="server" Text='<%# Eval("Email") %>' NavigateUrl='<%# "mailto:" & Eval("Email").ToString() %>' />
            </ItemTemplate>
         </asp:TemplateField>
         <asp:HyperLinkField Text="Edit" DataNavigateUrlFormatString="EditUser.aspx?UserName={0}" DataNavigateUrlFields="UserName" />
         <asp:HyperLinkField Text="Delete" DataNavigateUrlFormatString="DeleteUser.aspx?UserName={0}" DataNavigateUrlFields="UserName" />
      </Columns>
      <EmptyDataTemplate><b>No users found for the specified criteria</b></EmptyDataTemplate>
   </asp:GridView>
   <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ClubSiteDB %>"
                SelectCommand="GetUsersAll" SelectCommandType="StoredProcedure" DataSourceMode="DataReader">
            </asp:SqlDataSource>
  
   <asp:GridView ID="ApprovedUsersGrid" runat="server" AutoGenerateColumns="False" DataKeyNames="UserName" GridLines="None" Width="678px" DataSourceID="SqlDataSource2">
      <Columns>
         <asp:TemplateField HeaderText="Name">
            <ItemTemplate>
                <asp:Label id="DisplayName" runat="server" Text='<%# Eval("firstname").ToString() & " " & Eval("lastname").ToString() %>' />
            </ItemTemplate>
         </asp:TemplateField>
         <asp:BoundField HeaderText="UserName" DataField="UserName" />
         <asp:TemplateField HeaderText="E-Mail">
            <ItemTemplate>
                <asp:HyperLink ID="email" runat="server" Text='<%# Eval("Email") %>' NavigateUrl='<%# "mailto:" & Eval("Email").ToString() %>' />
            </ItemTemplate>
         </asp:TemplateField>
         <asp:HyperLinkField Text="Edit" DataNavigateUrlFormatString="EditUser.aspx?UserName={0}" DataNavigateUrlFields="UserName" />
         <asp:HyperLinkField Text="Delete" DataNavigateUrlFormatString="DeleteUser.aspx?UserName={0}" DataNavigateUrlFields="UserName" />
      </Columns>
      <EmptyDataTemplate><b>No users found for the specified criteria</b></EmptyDataTemplate>
   </asp:GridView>
   <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ClubSiteDB %>"
                SelectCommand="GetUsersByApproval" SelectCommandType="StoredProcedure" DataSourceMode="DataReader">
                <SelectParameters>
                    <asp:Parameter Name="approved" DefaultValue="True" Type="Boolean" />
                </SelectParameters>
            </asp:SqlDataSource>
   
   <asp:GridView ID="UnapprovedUsersGrid" runat="server" AutoGenerateColumns="False" DataKeyNames="UserName" GridLines="None" Width="678px" DataSourceID="SqlDataSource3">
      <Columns>
         <asp:TemplateField HeaderText="Name">
            <ItemTemplate>
                <asp:Label id="DisplayName" runat="server" Text='<%# Eval("firstname").ToString() & " " & Eval("lastname").ToString() %>' />
            </ItemTemplate>
         </asp:TemplateField>
         <asp:BoundField HeaderText="UserName" DataField="UserName" />
         <asp:TemplateField HeaderText="E-Mail">
            <ItemTemplate>
                <asp:HyperLink ID="email" runat="server" Text='<%# Eval("Email") %>' NavigateUrl='<%# "mailto:" & Eval("Email").ToString() %>' />
            </ItemTemplate>
         </asp:TemplateField>
         <asp:HyperLinkField Text="Edit" DataNavigateUrlFormatString="EditUser.aspx?UserName={0}" DataNavigateUrlFields="UserName" />
         <asp:HyperLinkField Text="Delete" DataNavigateUrlFormatString="DeleteUser.aspx?UserName={0}" DataNavigateUrlFields="UserName" />
         <asp:HyperLinkField Text="Approve" DataNavigateUrlFormatString="~/member/adminverification.aspx?username={0}" DataNavigateUrlFields="UserName" />
      </Columns>
      <EmptyDataTemplate><b>No users found for the specified criteria</b></EmptyDataTemplate>
   </asp:GridView>
   <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:ClubSiteDB %>"
                SelectCommand="GetUsersByApproval" SelectCommandType="StoredProcedure" DataSourceMode="DataReader">
                <SelectParameters>
                    <asp:Parameter Name="approved" DefaultValue="False" Type="Boolean" />
                </SelectParameters>
            </asp:SqlDataSource>
   </ContentTemplate></asp:UpdatePanel>
   <asp:UpdateProgress ID="up1progress" runat="server" AssociatedUpdatePanelID="Up1" DisplayAfter="20"><ProgressTemplate>
    <asp:Image ID="loading1" runat="server" SkinID="loading" />
   </ProgressTemplate></asp:UpdateProgress>
    <br />
    <br />
    NOTE: Deleting yourself as you are loged in will cause the site to break. If this
    occurs, delete your cookies.</div>
   </div>
</asp:Content>

